#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
struct ListNode
{
    int val;
    struct ListNode* next;
};
typedef struct ListNode LNode;
struct ListNode* reverseList(struct ListNode* head) {
    LNode* pcur = head;
    LNode* pnext = NULL;
    LNode* prev = NULL;
    while (pcur)
    {
        pnext = pcur->next;
        pcur->next = prev;
        prev = pcur;
        pcur = pnext;
        if (pnext)
        {
            pnext = pnext->next;
        }
    }
    return prev;
}